from Products.PlonePAS.Extensions.Install import activatePluginInterfaces
from Products.CMFCore.utils import getToolByName
from StringIO import StringIO
from plugins.aidentu_auth import addAidentuPlugin

def importVarious(context):
    ''' Install the AidentuPAS plugin
    '''
    out = StringIO()
    portal = context.getSite()

    uf = getToolByName(portal, 'acl_users')
    installed = uf.objectIds()

    if 'aidentupas' not in installed:
        addAidentuPlugin(uf, 'aidentupas', 'AIdentU PAS','http://localhost:8000/cohab/xmlrpc/','andre123')
        activatePluginInterfaces(portal, 'aidentupas', out)
    else:
        print >> out, 'aidentupas already installed'

    print out.getvalue()
